home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / exec / copylist.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  956 b   |  43 lines

  1. /*
  2. \funcref{copylist}{VAR\_ copylist (\params)}
  3.     {
  4.         {VAR\_} {v} {variable holding list to copy}
  5.     }
  6.     {variable with copied list}
  7.     {xrealloc(), xstrdup()}
  8.     {inlist(), addtolist()}
  9.     {copylist.c}
  10.     {
  11.         This function copies the list of the variable which is stated as a
  12.         parameter. A variable holding the copied list is returned.
  13.  
  14.         The type of the returned variable is set to {\em e\_list}, while the
  15.         {\em e\_temp} flag is also set.
  16.     }
  17. */
  18.  
  19. #include "icm-exec.h"
  20.  
  21. VAR_ copylist (v)
  22. VAR_ v;
  23. {
  24.     register unsigned
  25.         i;
  26.     VAR_
  27.         ret;
  28.     LIST_
  29.         *vlist,
  30.         *rlist;
  31.  
  32.     ret = newvar (e_list);
  33.  
  34.     rlist = &(ret.vu.i->ls.list);
  35.     vlist = &(v.vu.i->ls.list);
  36.     rlist->size = vlist->size;
  37.     rlist->element = xrealloc (NULL, (vlist->size * sizeof (char *)));
  38.     for (i = 0; i < vlist->size; i++)
  39.         rlist->element [i] = xstrdup (vlist->element [i]);
  40.  
  41.     return (ret);
  42. }
  43.